{#include file="top.php"#}

<meta property="og:image" content="{#$global_url#}{#$product._photo_url#}" />
<meta property="og:description" content="{#$product.body#}" />


<div class="body">

    <div class="main fl">
        <div class="crumb">
            <a href="{#optimize_url('product', 'submitReport_list', 'mtype=1')#}">試用專區</a> &gt;
            <strong>提交報告</strong>
        </div>
        <div class="ti_box b_box ti_box_try">
            <div class="hd">
                <h2 class="ir ht"><span>提交報告 TRIAL INVITATION</span></h2>
            </div>
            <div class="bd">
                <div class="areabox try">
                    <h2 class="at">試用專區</h2>
                    <div class="lbox">
						<div class="imgbox"><p class="img_p"><a  class="img_lightbox" title="{#$product.cname#}" href="/{#$product.cover#}"><span><img src="{#$product._photo_url#}"></span></a></p></div>
                        <em class="hack"></em>
                        {#if $memberData.member_type==0#}
                        <a href="/member.php?action=regTrial" class="btn_b btn_b_totrydaren"><strong>立刻成為試用達人</strong></a>
                        {#/if#}
                    </div>
                    <div class="rbox">
                        <a href="http://service.weibo.com/share/share.php?url={#$thisUrl#}&title={#$product.name#}-{#$product.cname#}-提交報告&pic={#$global_url#}{#$product._photo_url#}" class="ir fb_icon" target=_blank><span>facebook</span></a>
                        <a href="javascript:void(0);"  class="ir sina_icon" onclick="postToFeed()"><span>facebook</span></a>
                        
                        
                        <div class="tbox">
                            <table width="100%" border="0" cellpadding="0">
                                <tr>
                                    <td colspan="2" class="tt">{#$product.type_name#}</td>
                                </tr>
                                <tr>
                                    <td colspan="2" > {#$product.name#}</td>
                                </tr>
                                <tr>
                                    <td colspan="2">{#$product.cname#}</td>
                                </tr>
                                <tr>
                                <table width="100%" border="0" cellpadding="0">
                                    {#foreach from=$product['_attr'] item=v key=k#}
                                    <tr class="sep">
                                        <td class="label"><span>：</span>{#$k#}</td>
                                        <td>{#$v#}</td>
                                    </tr>
                                    {#/foreach#}
                                </table>
                                </tr>
                            </table>
                        </div>
                        <div class="infobox">
                            <span class="snumbox">
                                <sup>名額</sup><span class="num">{#$product.quota#}</span>&nbsp;
                                {#if $product.apply_num#} <sup>申請人數</sup><span class="num">{#$product.apply_num#}</span>&nbsp;{#/if#}
                                <sup>人氣</sup><span class="num">{#$product.click#}</span>
                            </span><a class="btn btn_s_report" style="cursor:pointer" onclick="apply({#$pid#})"><span>立即申請</span></a>

                            {#if empty($product._difTime.0)#}
                            <div class="text_over_info"><strong class="text_over"></strong></div>
                            {#else#}
                            <div class="info"><span>尚餘</span><strong>{#$product._difTime.0#}</strong><sub>{#$dateArr[$product._difTime.1]#}</sub></div>
                            {#/if#}

                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!--step-->
        <div class="stepbox">
            <div class="steps_b"><span>step1 成為體驗大人/試用專員,step2 成為體驗大人/試step3 成為體驗大人/試用專員用專員,</span></div>
        </div>
        {#if !empty($userlist1)#}
        <div class="hybox">
            <div class="tagbox clearfix">
                <div class="t1 t curr" id=sl1 onmouseover='show_ul(1)' style="cursor:pointer"><em class="hack">&nbsp;</em><span class="ir txt txt1">邀請會員</span></div>
                <!-- <div class="t2 t" id=sl2 onmouseover='show_ul(2)' style="cursor:pointer"><em class="hack">&nbsp;</em><span class="ir txt txt2"  >已申請會員</span></div>-->

            </div>
            <div class="imgs" id='userlist1'>
                <div class="ul clearfix" >
                    <div class="listw" id="intro_content" style="overflow:hidden;height:180px">
                        {#foreach from=$userlist1 item=v key=k#}
                        <span class="list">
                            <span class="infobox">
                                <span class="imgbox">
										<p class="img_p">
										<a href="{#optimize_url('person', 'report', 'username='|cat:$v.username)#}"> <span>
										<img src="{#$v.photo_l#}" width=56>
								</span></a></p>
										</span><br>
                                <span class="intro">{#$v.username#}</span>
                            </span>
                        </span>
                        {#/foreach#}

                        <span class="list left_fix">&nbsp;</span>
                    </div>
                </div>
                <div class="bar" id="intros_scroll">

                </div>
            </div>
            <!--
            <div class="imgs" id='userlist2' style="display:none">
                    <div class="ul clearfix" >
                    <div class="listw"  id="intro_content1" style="overflow:hidden;height:180px">
                        {#foreach from=$userlist2 item=v key=k#}
                        <span class="list">
                            <span class="infobox">
                                <span class="imgbox"><a href="{#optimize_url('person', 'report', 'username='|cat:$v.username)#}"><img src="{#$v.photo_l#}" width=56 /></a></span><br>
                                <span class="intro">{#$v.username#}</span>
                            </span>
                        </span>
                        {#/foreach#}
                    <span class="list left_fix">&nbsp;</span>
                    </div>
                    </div>
                    <div class="bar"  id="intros_scroll1">

                    </div>
              </div>-->
        </div>
        {#/if#}
        {#if !empty($reportlist)#}
        <div class="trbox b_box ti_box">
            <div class="hd">
                <h2 class="ir ht" ><span>試用申請 TRIAL REGISTRATION</span></h2>
            </div>
            <div class="bd">
                {#foreach from=$reportlist item=v key=k#}
                <div class="iibox {#if count($reportlist) eq ($k+1)#}last{#/if#}" >
                    <div class="imgbox">
										<p class="img_p">
										<a href="{#optimize_url('person', 'report', 'username='|cat:$v.username)#}"> <span>
										<img src="{#$v.photo_l#}" width=56>
								</span></a></p>
										</div>
                    <div class="infobox">
                        <p><a href="{#optimize_url('person', 'report', 'username='|cat:$v.username)#}">{#$v.username#}</a></p>
                        <p>年齡：{#$v.age#}</p>
                        <p>臉部膚質：{#$v.body_skin#}</p>
                        <p class="multi multi1">
                            <label class="lb">申請原因：</label>
                            <span>{#nl2br($v.body)#}</span>
                        </p>
                    </div>
                    <!--{#if $v.application_status==7 || $v.application_status==9#}<a class="passbtn" >通過</a>{#else#}<a class="processbtn">審核中</a>{#/if#}-->
                </div>
                {#/foreach#}

            </div>
        </div>
        {#$pagelist#}
        {#/if#}
    </div>
    <!-- main-->
    <div class="sidebar">
        {#show_block('b2',1,'','sidebar_ad')#}
        {#show_block('b1',2,'','sidebar_function')#}
        {#show_block('b3',0,'','sidebar_search')#}
        {#show_block('b13',0,'','sidebar_registation')#}
        {#show_block('b4',0,'','sidebar_workshop')#}
        {#show_block('b9',0,'','sidebar_tutorial b_box')#}
        {#show_block('b6',0,'','sidebar_facebook')#}
    </div>
    <!-- sidebar -->

</div><!--body-->

<!--  遮罩層  -->
<div id="fullbg"></div>
<div  class="irpopbox popbox b_box" style="top:400px;z-index:60;display:none;" id="dialog">
    <div class="hd">
        <h2 class="ir ht" id=loginTextName><span id=loginText>iTRIAL 會員登入 REGISTRATION</span></h2>
        <a class="popclose" style="cursor:pointer" onclick="closeLB();">close</a>
    </div>
    <div class="bd">
        <div class="lbox">
            <p>會員名稱 USERNAME</p>
            <input type="text" class="ipt" name="email" id="email">
            <p>密碼 PASSWORD</p>
            <input type="password" class="ipt" name="password" id="password">
            <a class="btn_s btn_s_login" onclick="login()" style="cursor:pointer" id="login"><strong>login</strong></a>
            <ul>
                <li><a href="/member.php?action=forgetPassword">忘記密碼</a></li>
                <li><a href="/member.php?action=reg&toURL={#$thisUrl#}">註冊新帳號</a></li>
            </ul>
        </div>
        <div class="rbox">
            <div class="lgbox"><em class="hack"></em>
                <a class="fbtn ir" href="/member.php?action=login_facebook&toURL={#$thisUrl#}"><strong>以facebook登入</strong></a><span><a class="fb_link" href="/member.php?action=login_facebook&toURL={#$thisUrl#}">以facebook登入</a></span>
            </div>
            <div class="lgbox lgbox2" onClick="fnblogin()" id=login_type style="cursor:pointer" ><em class="hack"></em>
                <a class="fabtn ir" id=classlogo><strong>以F&amp;B登入</strong></a><span id=login_type_text  >以F&amp;B登入</span>
            </div>
        </div>
    </div>
</div>
<div style="top:400px;z-index:60;display:none;" class="apopbox popbox b_box" id="dialog_popup">
    <div class="hd">
        <h2 class="ir ht"><span>提示信息 ALERT</span></h2>
        <a class="popclose" onclick="closeLB();" style="cursor:pointer">close</a>            </div>
    <div class="bd">
        <p id="popupText"></p>
        <a class="btn_b btn_s_im_back" href="javascript:void(0);" onclick="closeLB();"><strong>立即返回</strong></a>
    </div>
</div>

<script type="text/javascript">
    function ajax_fb_ponits(){       
        
        $.ajax({
            url : '/ajax_points.php?action=ajax_fb_points',
            type : 'POST',
            data: "code={#php#}echo md5('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'imoreHK');{#/php#}&action_name=share_product_invite&remark={#str_replace("'","’",$product.cname)#}",
            dataType : 'json',
            success: function(data){
                if(data.ret==0){
                    // console.info("未登入");
                }else if(data.ret==1){
                    if(data.data.ret==1){
                        // console.info(data.data.action);
                    }else{
                        //  console.info(data.data.reason);
                    }
                    
                }else{
                    // console.info(data.reason);
                }
            }
        });
        
    }
    
    function postToFeed() {

        // calling the API ...
        var obj = {
            method: 'feed',
            //redirect_uri: '{#php#}echo DOMAIN;{#/php#}product.php?action=invite_inpage&mtype=1&pid={#$product.id#}',
            link: '{#php#}echo DOMAIN;{#/php#}product.php?action=invite_inpage&mtype=1&pid={#$product.id#}',
            picture: '{#php#}echo DOMAIN;{#/php#}{#$product._photo_url#}',
            name: '{#str_replace("'","’",$product.cname)#}',
            caption: '{#str_replace("'","’",$product.type_name)#}',
			description: '{#str_replace("'","’",str_replace(array("\r\n", "\n", "\r"),"",strip_tags(htmlspecialchars_decode($product.body))))#}'
        };

       

        FB.ui(obj, function(response){
            if(response['post_id']){
                ajax_fb_ponits();
            }
        });
    }
    
    $(function() {
        $('.img_lightbox').lightBox();
    });

    function showpop(text){
        $("#fullbg").fadeIn();
        $("#dialog1").fadeOut('slow');
        $("#dialog").fadeOut('slow');
        showLB('dialog_popup',0);
        $("#popupText").text(text);
    }
    function show_ul(n){

        switch(n){
            case 1:
                $('#userlist1').show();
                $('#userlist2').hide();
                $("#sl1").attr("class","t1 t curr");
                $("#sl2").attr("class","t2 t");
                break;
            case 2:
                $('#userlist2').show();
                $('#userlist1').hide();
                $("#sl1").attr("class","t1 t ");
                $("#sl2").attr("class","t2 t curr");
                break;
            default:
                break;
        }
    }

    function apply(pid){
        $.getJSON("/product.php?action=ajax&t=13",{pid:pid},function(data){
            if(parseInt(data.login)==1){
                if(parseInt(data.email)==1){
                    if(parseInt(data.limit)==1){
                        if(parseInt(data.s)==1 || parseInt(data.s)==4){
                            showpop(data.msg);
                            //window.location.href='product.php?action=report_add&pid={#$pid#}';
                        }else if(parseInt(data.s)==2 || parseInt(data.s)==3){
                            window.location.href='/member_center.php?action=report';
                        }
                    }else{
                        $("#popupText").html("你還未成為試用專員，<a href='/member.php?action=regTrial&toURL={#$thisUrl#}'>立即申請</a>！");
                        showLB('dialog_popup',0);
                    }
                }else{
                    $("#popupText").html("您的電郵地址尚未驗證，請先激活！<a class='pink' href='/member.php?action=resendActivation' target='_blank'>重發激活郵件</a>");
                    showLB('dialog_popup',0);
                }
            }else{
                $("#loginText").text("iTRIAL 會員登入 REGISTRATION");
                $("#login").attr("onClick","login('apply("+pid+")')");
                $("#login_type").attr("onClick","fnblogin('apply("+pid+")')");
                showLB('dialog',0);
            }
        });
    }

    function login(func){

        var email = $('#email').val();
        if($.trim(email).length==0){
            showpop("{#$NO_USERNAME#}");
            $('#email').focus();
            return false;
        }
        var password = $('#password').val();
        if($.trim(password).length==0){
            showpop("{#$NO_PASSWORD#}");
            $('#password').focus();
            return false;
        }
        /*
                var captcha = $('#captcha').val();
                if($.trim(captcha).length==0){
                        showpop("{#$ERR_CAPTCHA#}");
                        $('#captcha').focus();
                        return false;
                }
         */

        $.getJSON("/member.php?action=ajax_login_imore",{email:email,password:password/*,captcha:captcha*/},function(data){
            if(parseInt(data.ret)==1){
                showpop(data.msg);
            }else if(parseInt(data.ret)==2){
                showpop(data.msg);
                //$('#captcha').attr("src","captcha.php?t="+Math.random());
            }else{closeLB();memberBar();eval(func);}
        });
    }

    function login_fnb(func){
        var email = $('#email').val();
        if($.trim(email).length==0){
            showpop("{#$NO_USERNAME#}");
            $('#email').focus();
            return false;
        }
        var password = $('#password').val();
        if($.trim(password).length==0){
            showpop("{#$NO_PASSWORD#}");
            $('#password').focus();
            return false;
        }
        /*
                var captcha = $('#captcha').val();
                if($.trim(captcha).length==0){
                        showpop("{#$ERR_CAPTCHA#}");
                        $('#captcha').focus();
                        return false;
                }
         */


        $.getJSON("/member.php?action=ajax_login_fnb",{email:email,password:password/*,captcha:captcha*/},function(data){
            if(parseInt(data.ret)==1){
                showpop(data.msg);
            }else if(parseInt(data.ret)==2){
                showpop(data.msg);
                $('#captcha').attr("src","captcha.php?t="+Math.random());
            }else{closeLB();memberBar();eval(func);}
        });
    }

    function fnblogin(func){
        $("#loginText").text("F&amp;B 會員登入 REGISTRATION");
        $("#login").attr("onClick","login_fnb("+func+")");
        $("#login_type_text").text("以 iMORE 登入");
        $("#login_type").attr("onClick","itriallogin("+func+")");
        $("#loginTextName").css("background-position","0 -940px");
        $("#classlogo").attr("class","itrial ir");
    }
    function itriallogin(func){
        $("#loginText").text("iTRIAL 會員登入 REGISTRATION");
        $("#login").attr("onClick","login("+func+")");
        $("#login_type_text").text("以 F&B 登入");
        $("#login_type").attr("onClick","fnblogin("+func+")");
        $("#loginTextName").css("background-position","0 -900px");
        $("#classlogo").attr("class","fabtn ir");
    }


    function showLB(ct,n){
        var sh=$(document).height();
        var sw=$(document).width();
        var ch=$(window).height();
        var cw=$(window).width();
        var st=$(window).scrollTop();
        var sl=$(window).scrollLeft();
        var objH=$("#"+ct).height();
        var objW=$("#"+ct).width();
        var tbT=(Number(st)+(Number(ch)-Number(objH))/3)+"px";
        var tbL=(Number(sl)+(Number(cw)-Number(objW))/2)+"px";
        if(n==0){
            $("#fullbg").css({width:sw,height:sh});
            $("#"+ct).css({top:tbT});
            $("#fullbg").fadeTo('slow', 0.4);
            $("#"+ct).fadeIn('slow');
            $(window).scroll(function(){showLB(ct,1)});
            $(window).resize(function(){showLB(ct,1)});
        }else{
            if($("#fullbg").css("display")=="block"){
                $("#fullbg").css({width:sw,height:sh});
                $("#"+ct).css({top:tbT});
            }
        }
    }

    function closeLB(){
        $("#fullbg").fadeOut('slow');
        $("#dialog").fadeOut('slow');
        $("#dialog_limits").fadeOut('slow');
        $("#dialog_popup").fadeOut('slow');

    }

</script>
<script src="/js/jquery.event.drag.min.js"></script>

<script>
    var is_apple=0;
    setTimeout( function(){$("#intro_content").fadeIn('normal',function(){
            bindSilder("intro_content", "intros_scroll");
        });}, ( 300 ) );

    setTimeout( function(){$("#intro_content1").fadeIn('normal',function(){
            bindSilder("intro_content1", "intros_scroll1");
        });}, ( 300 ) );
</script>
{#include file="footer.php"#}